<template>
	<view>
		<view class="skill-sequence-panel-content-wrapper">
			<!--左边虚化-->
			<view class="hide-content-box hide-content-box-left"></view>
			<!--右边虚化-->
			<view class="hide-content-box hide-content-box-right"></view>
			<!-- 中间数据 -->
			<scroll-view scroll-x="true" class="kite-classify-scroll">
				<view class="screen" v-for="(item, index) in curriculum" :key="index"
					:class="{'special' : currindex== index}" @click="onclick(item,index)">
					{{ item.name }}
				</view>
			</scroll-view>
		</view>
		<view>
			<view class="nav" v-for="(item,index) in projectList" :key="index" @click="onSelect(item)">
				<view class="title">{{item.infoTitle}}</view>
				<view class="nav_content uni-ellipsis-2">{{item.infoAbs}}</view>
				<view class="endof">
					<view class="left">小默</view>
					<view class="right">{{item.creatTime.substring(0,10)}}</view>
				</view>
			</view>
			<image v-if="projectList.length == 0" class="NoData" src="https://img.wilmer.com.cn/admin/2024/3-20/WechatIMG19.jpg" mode=""></image>
		</view>
	</view>
</template>

<script>
	import {
		schoolList
	} from '@/common/api/homePage.js'
	export default {
		data() {
			return {
				curriculum: [{
						name: '全部',
						content: ''
					},
					{
						name: '院校资料',
						content: '院校资料'
					},
					{
						name: '申请信息',
						content: '申请信息'
					},
					{
						name: '奖学金',
						content: '奖学金'
					},
					{
						name: '活动预告',
						content: '活动预告'
					},
					{
						name: '简报',
						content: '简报'
					}
				],
				infoType: "",
				projectList: [],
				currindex: 0,
				statusBarHeight: 0, // 状态栏高度
				navigationBarHeight: 44, // 导航栏高度
			}
		},
		onShow() {
			// 获取状态栏高度
			const systemInfo = uni.getSystemInfoSync();
			this.statusBarHeight = systemInfo.statusBarHeight || 0;
		},
		mounted() {
			this.getData();
		},
		methods: {
			getData() {
				uni.showLoading({
					title: '加载中'
				});
				schoolList({
					infoType: this.infoType
				}).then(res => {
					if (res.data.code == 200) {
						this.projectList = res.data.rows;
					} else {}
					setTimeout(() => {
						uni.hideLoading();
					}, 500)
				});
			},
			onclick(item, index) {
				this.currindex = index
				this.infoType = item.content
				this.getData()
			},
			onSelect(item) {
				uni.navigateTo({
					url: `/pages/knowledge/index?id=${item.infoId}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.uni-ellipsis-2 {
		display: -webkit-box;
		overflow: hidden;
		text-overflow: ellipsis;
		word-wrap: break-word;
		white-space: normal !important;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.screen {
		display: inline-block;
		padding: 6rpx 14rpx;
		border-radius: 52rpx;
		background: linear-gradient(0deg, #D9D9D9, #D9D9D9),
			linear-gradient(0deg, #F1F2F6, #F1F2F6);
		font-family: PingFang SC;
		font-size: 14px;
		font-weight: 400;
		color: #999999;
		margin-left: 20rpx;
	}

	.special {
		color: #FFFFFF;
		background: #6CAFFF;
	}

	/*scroll-view外层*/
	.skill-sequence-panel-content-wrapper {
		position: relative;
		white-space: nowrap;
		padding: 10rpx 0 10rpx 10rpx;
	}

	/*左右渐变遮罩*/
	.hide-content-box {
		position: absolute;
		top: 0;
		height: 100%;
		width: 10px;
		z-index: 2;
	}

	.hide-content-box-left {
		left: 0;
		background-image: linear-gradient(to left, rgba(255, 255, 255, 0), #f3f3f3 60%);
	}

	.hide-content-box-right {
		right: 0;
		background-image: linear-gradient(to right, rgba(255, 255, 255, 0), #f3f3f3 60%);
	}

	.kite-classify-scroll {
		margin-top: 8px;
		width: calc(100% - 20px);
		overflow: hidden;
		white-space: nowrap;
	}

	.nav {
		width: 686rpx;
		border-radius: 6px;
		box-shadow: 0px 1px 4px 1px #00000026;
		background: #FFFFFF;
		margin: 20rpx auto 0;
		padding: 20rpx 0;

		.title {
			width: 640rpx;
			margin: 0 auto;
			font-family: PingFang SC;
			font-size: 28rpx;
			font-weight: 500;
			line-height: 1;
			color: #333333;
		}

		.nav_content {
			width: 640rpx;
			font-family: PingFang SC;
			font-size: 24rpx;
			font-weight: 400;
			color: #666666;
			margin-top: 20rpx;
			margin: 20rpx auto 0;
		}

		.endof {
			margin-top: 30rpx;
			font-family: PingFang SC;
			font-size: 24rpx;
			font-weight: 400;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.left {
				margin-left: 20rpx;
			}

			.right {
				margin-right: 40rpx;
			}
		}

	}

	.NoData {
		display: block;
		width: 400rpx;
		height: 318rpx;
		margin: 40rpx auto 0;
	}
</style>